home *** CD-ROM | disk | FTP | other *** search
/ Tech Arsenal 1 / Tech Arsenal (Arsenal Computer).ISO / tek-04 / shazam11.zip / DEMOSE.VIR < prev    next >
Text File  |  1991-11-04  |  8KB  |  210 lines

  1.    {===================================================================
  2.  
  3.    VARIABLES & OBJECTS
  4.  
  5.    ===================================================================}
  6. const
  7.    HeapSize                  = 32 * ( 1024 div 16 ) ;  { reserve 32 k }
  8. var
  9.    ClipWindow                : PEditWindow ;              { Clipboard }
  10.    Clock                     : PClockView ;                  { Gadget }
  11.    {===================================================================
  12.  
  13.    Make use of idle time
  14.  
  15.    ===================================================================}
  16. procedure TDemoSEApp.Idle ;
  17. begin
  18.    TApplication.Idle ;
  19.    Clock^.Update ;
  20. end ;
  21.    {===================================================================
  22.  
  23.    MESSAGE
  24.  
  25.    ===================================================================}
  26. procedure SyntaxMessage ;
  27. begin
  28.    writeln ( 'SYNTAX:  C:>ed               {loads DOS & Windows files}' ) ;
  29.    writeln ( '         C:>ed filename      {load ''filename''}' ) ;
  30.    writeln ( '         C:>ed filespec      {multi-load ''filespec''; eg: *.bat}' ) ;
  31.    writeln ;
  32.    writeln ( '   Start-up file     Used by   Description' ) ;
  33.    writeln ( '   ---------------   -------   -----------------------------------' ) ;
  34.    writeln ( '   <> AUTOEXEC.BAT   DOS       AUTOmatic EXECution BATch file' ) ;
  35.    writeln ( '   <> CONFIG.SYS     DOS       CONFIGure SYStem file' ) ;
  36.    writeln ( '   <> WIN.INI        Windows   WINdows INItialization file' ) ;
  37.    writeln ( '   <> SYSTEM.INI     Windows   SYSTEM hardware INItialization file' ) ;
  38. end ;
  39.    {===================================================================
  40.  
  41.    PRE
  42.  
  43.    BUFFERS.TPU re-arranges heap pointers.  Whatta pain, but some smart
  44.    guy might turn this into virtual memory someday, like WordPerfect.
  45.  
  46.    ===================================================================}
  47. procedure TDemoSEApp.PreInit ;
  48. var
  49.    H                         : word ;
  50. begin
  51.    writeln ( '- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -' ) ;
  52.    writeln ( '░▒▓█ Ye Olde Systeme Editor █▓▒░  Copyright (c) 1991 Johnathan J. Stein' ) ;
  53.    writeln ( '- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -' ) ;
  54.    if ( ParamStr ( 1 ) = '?' ) or
  55.       ( ParamStr ( 1 ) = '/?' ) then
  56.    begin
  57.       SyntaxMessage ;
  58.       HALT ;
  59.    end ;
  60.    PushScreen ;
  61.    H                         := PtrRec ( HeapEnd ).Seg -
  62.                                 PtrRec ( HeapPtr ).Seg ;
  63.    if H > HeapSize then
  64.       BufHeapSize            := H - HeapSize
  65.    else
  66.       BufHeapSize            := 0 ;
  67.    InitBuffers ;
  68. end ;
  69.    {===================================================================
  70.    POST
  71.    ===================================================================}
  72. procedure TDemoSEApp.PostInit ;
  73. var
  74.    R                         : TRect ;
  75.    SR                        : SearchRec ;
  76.    FileCount                 : byte ;
  77.    Event                     : TEvent ;
  78. begin
  79.    {- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  80.    Clock
  81.    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -}
  82.    GetExtent ( R ) ;
  83.    R.A.X                     := R.B.X - 9 ;
  84.    R.B.Y                     := R.A.Y + 1 ;
  85.    Clock                     := New ( PClockView , 
  86.                                       Init ( R ) ) ;
  87.    {- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  88.    Desktop
  89.    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -}
  90.    Insert ( Clock ) ;
  91.    {- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  92.    Disable EGA/VGA
  93.    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -}
  94.    if not HiResScreen or ( Screenmode = smMono ) then
  95.       Desktop^.DisableCommands ( [ cmVideoMode ] ) ;       
  96.    DisableCommands ( [ cmSave,
  97.                        cmSaveAs,
  98.                        cmCut,
  99.                        cmCopy,
  100.                        cmPaste,
  101.                        cmClear,
  102.                        cmUndo,
  103.                        cmFind,
  104.                        cmReplace,
  105.                        cmSearchAgain ] ) ;
  106.    {- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  107.    DIALOGS & CLIP BOARD
  108.    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -}
  109.    EditorDialog              := DoEditDialog ;
  110.    ClipWindow                := OpenEditor ( '' , FALSE ) ;
  111.    if ClipWindow <> NIL then
  112.    begin
  113.       Clipboard              := ClipWindow^.Editor ;
  114.       Clipboard^.CanUndo     := FALSE ;
  115.    end ;
  116.    {- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  117.    LOAD SYSTEM FILES
  118.    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -}
  119.    FileCount              := 0 ;
  120.    if ParamCount = 0 then
  121.    begin
  122.       FileCount              := 4 ;
  123.       LoadWinIni ;
  124.       LoadDosIni ;
  125.       heTile ;
  126.    end
  127.    {- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  128.    LOAD FILENAME
  129.    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -}
  130.    else
  131.    if ( Pos ( '*' , ParamStr ( 1 ) ) = 0 ) and
  132.       ( Pos ( '?' , ParamStr ( 1 ) ) = 0 ) then
  133.    begin
  134.       OpenEditor ( ParamStr ( 1 ) , TRUE ) ;        { no wildcards }
  135.       inc ( FileCount ) ;
  136.    end
  137.    else
  138.    {- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  139.    MULTI-LOAD
  140.    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -}
  141.    begin
  142.       FindFirst ( ParamStr ( 1 ) , AnyFile , SR ) ;
  143.       while DosError = 0 do
  144.       begin
  145.          if ( SR.Attr and Directory = 0 ) and
  146.             ( SR.Attr and ReadOnly = 0 ) and
  147.             ( SR.Attr and Hidden = 0 ) and
  148.             ( SR.Attr and SysFile = 0 ) and
  149.             ( SR.Attr and VolumeID = 0 ) and
  150.             ( SR.Name <> '.' ) and
  151.             ( SR.Name <> '..' ) and
  152.             ( pos ( '.COM' , SR.Name ) = 0 ) and
  153.             ( pos ( '.EXE' , SR.Name ) = 0 ) and
  154.             ( pos ( '.OVR' , SR.Name ) = 0 ) and
  155.             ( pos ( '.OVL' , SR.Name ) = 0 ) and
  156.             ( pos ( '.VRM' , SR.Name ) = 0 ) and
  157.             ( pos ( '.BIN' , SR.Name ) = 0 ) and
  158.             ( pos ( '.SYS' , SR.Name ) = 0 ) and
  159.             ( pos ( '.HLP' , SR.Name ) = 0 ) and
  160.             ( pos ( '.CPI' , SR.Name ) = 0 ) and
  161.             ( pos ( '.DLL' , SR.Name ) = 0 ) and
  162.             ( pos ( '.LIB' , SR.Name ) = 0 ) and
  163.             ( pos ( '.BGI' , SR.Name ) = 0 ) and
  164.             ( pos ( '.CHR' , SR.Name ) = 0 ) and
  165.             ( pos ( '.ARC' , SR.Name ) = 0 ) and
  166.             ( pos ( '.ZIP' , SR.Name ) = 0 ) then
  167.          begin
  168.             OpenEditor ( SR.Name , TRUE ) ;
  169.             inc ( FileCount ) ;
  170.          end ;
  171.          FindNext ( SR ) ;
  172.    {- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  173.    LIMIT
  174.    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -}
  175.          if FileCount >= 16 then
  176.          begin
  177.             MessageBox ( 'Cannot auto-load more than 16 files' ,
  178.                          NIL ,
  179.                          mfInformation + mfOKbutton ) ;
  180.             DosError         := 18 ;
  181.          end ;
  182.       end ;
  183.       heCascade ;
  184.    end ;
  185.    {- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  186.    DISPLAY ABOUT IF NO FILES
  187.    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -}
  188.    if FileCount <> 0 then EXIT ;
  189.    Event.What                := evCommand ;
  190.    Event.Command             := cmAbout ;
  191.    PutEvent ( Event ) ;
  192. end ;
  193.    {===================================================================
  194.    PRE
  195.    ===================================================================}
  196. procedure TDemoSEApp.PreDone ;
  197. begin
  198.    Delete ( Clock ) ;
  199.    Dispose ( Clock , Done ) ;
  200. end ;
  201.    {===================================================================
  202.    POST
  203.    ===================================================================}
  204. procedure TDemoSEApp.PostDone ;
  205. begin
  206.    DoneBuffers ;
  207.    PopScreen ;
  208.    SyntaxMessage ;
  209. end ;
  210.